﻿@Cofe ?= {}

stringUtils =
   
  capitalise : (str) ->
    str.charAt(0).toUpperCase() + str.slice(1)
  
  find : (regex, lookup) ->
     regexp = new RegExp(regex);
     result = regexp.exec(lookup)
     if result is null then null else result[0]

  # http://stackoverflow.com/questions/7905929/how-to-test-valid-uuid-guid
  isGuid : (str) -> 
    /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(str);


 Cofe.stringUtils = stringUtils